package config

import (
	"github.com/lab-online/pkg/logger"
	"github.com/spf13/viper"
)

var GORMLogger = &logger.GORMLoggerConfig{}

func setupGORMLoggerConfig() {
	GORMLogger.SlowThreshold = 200
	GORMLogger.LogLevel = logger.LevelWarn | logger.LevelError
	GORMLogger.UseConsole = false
	GORMLogger.IgnoreRecordNotFoundError = false
	GORMLogger.ParameterizedQueries = false
	if err := viper.UnmarshalKey("gormLogger", &GORMLogger); err != nil {
		panic(err)
	}
	GORMLogger.SlowThreshold *= 1e6
}
